from django.http import HttpResponse ,HttpResponseRedirect
from django.template import RequestContext, loader
from django.core.urlresolvers import reverse

from django.shortcuts import render
from django.http import Http404

from django.shortcuts import get_object_or_404, render


def index(request):
    try:
        if request.session['user_id'] and request.session['first_name'] and request.session['last_name']:
            return HttpResponseRedirect('/')
    except:
        template = loader.get_template('login/index.html')
        context = RequestContext(request, {
            'isLogin': 0,
        })
        return HttpResponse(template.render(context))